/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ie.tcd.cs.railtickets.server.domain;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Wenbo Sun
 */
@Entity
@Table(name = "route")
public class Route implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "route_id")
    private long id;

    @Column(name = "route_no", unique = true)
    private String routeNo;

    @Column(name = "route_name")
    private String routeName;

    @Column(name = "seat")
    private int seat;


    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "route")
    private Set<RouteStation> routeStations;

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "route")
    private Set<RouteTime> timeTables;


    public Route() {
    }

    public Route(long id) {
        this.id = id;
    }

    public Route(String routeNo, String routeName, int seat) {
        this.routeNo = routeNo;
        this.routeName = routeName;
        this.seat = seat;
    }


    public String getRouteName() {
        return routeName;
    }

    public void setRouteName(String routeName) {
        this.routeName = routeName;
    }

    public String getRouteNo() {
        return routeNo;
    }

    public void setRouteNo(String routeNo) {
        this.routeNo = routeNo;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Set<RouteStation> getRouteStations() {
        return routeStations;
    }

    public void setRouteStations(Set<RouteStation> routeStations) {
        this.routeStations = routeStations;
    }

    public Set<RouteTime> getTimeTables() {
        return timeTables;
    }

    public void setTimeTables(Set<RouteTime> timeTables) {
        this.timeTables = timeTables;
    }

    public int getSeat() {
        return seat;
    }

    public void setSeat(int seat) {
        this.seat = seat;
    }
}
